﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using System.Linq;
using WPFExcelReport.Helpers;
using System.Windows.Input;
using System.Windows.Controls;
namespace WPFExcelReport
{
    /// <summary>
    /// 专用于坯布检验
    /// 1.扫描布卷号，进入验布，读取生产单信息
    /// 2.输入长度，修改数据库记录
    /// 3.剪出新布卷
    /// 4.打印标签
    /// 5.疵点保存修正
    /// 6.事件记录
    /// 7.纬纱扣除
    /// 8.织轴扣除
    /// </summary>
    public partial class TMRQI03
    {

        public TMRQI03()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VWBBST();
            this.DataContext = MV;
            InitializeComponent();
        }

        public override void Query()
        {
            QIHelper();
            base.Query();
        }
        public override void SaveCommand(object sender, RoutedEventArgs e)
        {
            QIHelper();
            base.SaveCommand(sender, e);
        }
        public override void QIHelper()
        {
            if (dwMaster == null)
                return;
            PM["RWKRS"] = TMV.WBBRWKRS;
            PM["RWLFD"] = TMV.WBBRWLFD;
            PM["RWPOS"] = TMV.WBBPOS;
            TMV.RVDEFAULT(PM);//删除现在小布卷的默认疵点 
            TMV.UpdateWBBST(dwMaster, 0);
            TMV.WBBWMNRKRS = MACHINEID.Substring(0, 2);
            TMV.WBBWMLFDNR = MACHINEID.Substring(2, 4);
            TMV.WBBWMPOS = MACHINEID.Substring(6, 2);
            TMV.VWBW.NWBBEW(dwMaster, "36", RUNID, dwMaster, "QI04");//Entry 
            TMV.VWBW.NWBBEW(dwMaster, "13", RUNID, dwMaster, "QI04");//Entry 
            TMV.VWBW.POSTCHG();
            PM["RWKRS"] = TMV.WBBRWKRS;
            PM["RWLFD"] = TMV.WBBRWLFD;
            PM["RWPOS"] = TMV.WBBPOS;
            PM["VERSION"] = 1;
            PM["ROLLLG"] = TMV.WBBSSTKLG;
            TMV.VWBF.SETSHIFT(PM);
            base.QIHelper();
        }
        public override void OnBRTChg()
        {
            TMV.WBBSBRT = BRT;
            TMV.WBBIBRT = BRT;
            base.OnBRTChg();
        }
    }
}
